<template>
    <div class="page-store-platform-store-present bg-content">
        <scroll-view scroll-x="true">
            <div class="table table-bordered" style="text-align: center; background: white; width: 700px;">
                <div class="tr">
                    <div class="td text-center bold" style="width: 100px;">用户账号</div>
                    <div class="td text-center bold" style="width: 200px;">用户昵称</div>
                    <div class="td text-center bold" style="width: 100px;">店铺编码</div>
                    <div class="td text-center bold" style="width: 200px;">店铺名称</div>
                    <div class="td text-center bold" style="width: 100px;">营业状态</div>
                </div>
                <div class="tr" v-for="(item, index)  in dataList" :key="item.id">
                    <div class="td text-center" style="width: 100px;">{{item.username}}</div>
                    <div class="td text-center" style="width: 200px;">{{item.name}}</div>
                    <div class="td text-center" style="width: 100px;"> {{item.tbStore.code}}</div>
                    <div class="td text-center" style="width: 200px;">{{item.tbStore.name}}</div>
                    <div class="td text-center" style="width: 100px;">{{item.tbStore.operatingStatusText }}</div>
                </div>
            </div>
        </scroll-view>

        <div style="padding-top: 10px; padding-bottom: 10px;">
            <u-loadmore :status="pagination.status" bg-color="#eeeeee"/>
        </div>
    </div>
</template>

<script>
    import {TbCommunityService} from "@/dev/services/tb-community.service";

    export default {
        data() {
            return {
                dataList: []
            }
        },
        onShow() {
            this.doRefresh(this.dataList);
        },
        // 上拉加载
        onReachBottom: function () {
            if (this.pagination.hasNextPage) {
                this.doInfinite()
            }
        },
        methods: {
            /**
             * 加载更多数据中
             * @param infiniteScroll
             */
            doInfinite(infiniteScroll) {
                const _self = this;
                new TbCommunityService().findTableCommunityMemberList({
                    pagination: _self.pagination,
                    data: {
                        'tbCommunity.id': _self.globalVariable.userInfo.tbCommunity.id,
                    },
                }).then(result => {
                    _self.pagination.refreshPage(result);
                    _self.dataList = [..._self.dataList, ...result.list];
                });
            },
        }
    }
</script>
